#include "protocol_t20.h"
#include "crc.h"

QByteArray Protocol::handShakeDown()
{
    QByteArray packet;
    packet.append(HeadDown);
    packet.append(0x01);
    packet.append(0x01);

    auto data = packet.mid(3);
    uint16_t check = modbus_crc16((uint8_t *) data.data(), data.size());

    packet.append(check >> 8);
    packet.append(0xff & check);

    return packet;
}
